home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / comms / zoc101.arj / ZOC / SCRIPT / QUEDIAL < prev    next >
Text File  |  1993-12-29  |  4KB  |  241 lines

  1. #########################################################
  2. #
  3. #    SCRIPT FOR FUNCTION MULTIDIAL AND CALLNEXT 
  4. #
  5. #   Thanks to Jay Sottolano for some improvements
  6. #    
  7. #########################################################
  8. #    
  9. #    If you select more than one entry to dial from the
  10. #    phonebook, they are stored in the file DIALQUE
  11. #    
  12. #    This script is automatically executed to connect
  13. #   to the first of these numbers. 
  14. #    CALLNEXT (from the Modem Menu) executes this script
  15. #   to connect to the next.
  16. #
  17. #########################################################
  18.  
  19.     debug 0; maxscan 5
  20.  
  21.     #    Read file and look if there's something in
  22.     call readfile
  23.     compn %max% with 1
  24.     ifhigh goto mbegin
  25.  
  26.     writeln "NOTHING MORE TO DO"
  27.     // shell   "del DIALQUE"
  28.     exit
  29.  
  30.  
  31. #####################################################
  32. #     MAIN LOOP
  33. #     
  34. :mbegin
  35.     #    begin with first
  36.  
  37.     send "AT^M"
  38.     delay 1
  39.  
  40.     setn q 0
  41.  
  42. :mloop0
  43.     cls
  44.     writeln "^[[1mQUEUE-DIAL (Abort with 'Stop Script' from toolbar)^[[m^M^J"
  45.     setn n 1
  46.     inc q
  47.  
  48. :mloop1
  49.  
  50.     #    Fetch data from record
  51.     seta name "%%box%n%%%"
  52.     seta boxdata "%name%"
  53.     seta box  "%boxdata%" |BOX=;  rtrim box
  54.     seta log  "%boxdata%" |LOG=;  rtrim log
  55.     seta emu  "%boxdata%" |EMU=;  rtrim emu
  56.     seta num  "%boxdata%" |TEL=;  rtrim num
  57.     seta baud "%boxdata%" |PARM=; rtrim baud
  58.     seta zone "%boxdata%" |ZONE=; rtrim zone
  59.     
  60.  
  61.     #    Call and wait for 90 sek. max
  62.     delay
  63.     write "Calling %box% ... Attempt #: %q%"
  64.     exact 1
  65.     compa "%baud%" with ""
  66.     ifnequ baud "%baud%"
  67.     ifnequ send ^M; 
  68.     compa "%zone%" with ""
  69.     ifnequ setunit "%zone%"
  70.     delay 1; dial "%num%"
  71.     timeout 90;
  72.     
  73. :mloop2
  74.     waitline
  75.  
  76.     #    Timeout, nothing happened - go on
  77.     ifbrk hangup
  78.     ifbrk delay 2
  79.     ifbrk goto mgoon
  80.  
  81.     exact 0
  82.  
  83.     #    Zyxels say 'RINGING' - ignore that
  84.     compa "%lastline%" with RINGING
  85.     ifequ goto mloop2
  86.  
  87.     #    CONNECT, so login
  88.     compa "%lastline%" with CONNECT
  89.     ifequ goto mlogin
  90.  
  91.     compa "%lastline%" with CARRIER
  92.     ifequ goto mlogin
  93.  
  94.     #    For anything else, try again
  95.  
  96. :mgoon
  97.     #    Call next (or first again)
  98.     inc n 
  99.     compn %n% with %max%
  100.     ifnequ goto mloop1
  101.     goto mloop0
  102.        
  103. :mlogin
  104.     #    We're in
  105.     #    (delete records from list that are equal in the first six digits)
  106.     seta like "%box%" +1 6
  107.     call DelLike
  108.     call writefile
  109.  
  110.     #    OPERAAAATOR!
  111.     beep 3
  112.     setemu %emu%
  113.  
  114.     #    Did they want something to do for a start?
  115.     seta  cmd "%boxdata%" |CMD=
  116.     %cmd%
  117.  
  118.     #    Process W1/S1-loop
  119.     exact 1
  120.     setn n 1
  121.  
  122.     #    Set name for logging
  123.     compa "%log%" with ""
  124.     ifnequ logname "%log%"
  125.  
  126.     #    Answer to all Wx= with Sx= (see phonebook)
  127. :mlogloop
  128.     seta  w "%boxdata%" |W%n%=
  129.     seta  s "%boxdata%" |S%n%=
  130.     exact 1
  131.     compa "%w%" with ""
  132.     ifequ goto mfinish
  133.  
  134.     rtrim w
  135.     rtrim s
  136.  
  137.     wait "%w%"
  138.     ifbrk writeln "Error: Did not receive '%w%'!"
  139.     ifbrk goto mfinish
  140.  
  141.     delay
  142.     send "%s%"
  143.  
  144.     inc n
  145.     goto mlogloop
  146.  
  147. :mfinish
  148.     exit
  149. #
  150. #    END OF MAIN LOOP
  151. #####################################################
  152. #
  153. #
  154. #
  155. #    SUBS
  156. #
  157. #
  158. #
  159. ##################################
  160. #    READ FILE
  161. ##################################
  162. :readfile
  163. #
  164.     setn max 0 
  165.     openfile "DIALQUE" r
  166.     compa "%lastline%" with "##ERROR##"
  167.     ifequ writeln "Error"
  168.     ifequ return
  169.  
  170. :rloop
  171.     inc max
  172.     getfile
  173.     seta box%max% "%lastline%"
  174.     compa "%lastline%" with "##EOF##"
  175.     ifnequ goto rloop
  176.  
  177.     closefile
  178.     return
  179. ##################################
  180.  
  181.  
  182. ##################################
  183. #    WRITE FILE
  184. ##################################
  185. :writefile
  186. #
  187.     openfile "DIALQUE" w
  188.     setn n 1
  189.  
  190. :wloop
  191.     seta name %%box%n%%%
  192.     compa "%name%" with "##EOF##"
  193.     ifequ goto wend
  194.  
  195.     seta tmp "%name%" +1 1
  196.     compa %tmp% with *
  197.     ifequ goto wgoon
  198.     putfile "%name%"
  199. :wgoon
  200.     inc n; goto wloop
  201.  
  202. :wend
  203.     closefile 
  204.     return
  205. ##################################
  206.  
  207.  
  208. #####################################
  209. #    REPLACE ALL ENTRIES LIKE %LIKE% 
  210. #    WITH "*" 
  211. #####################################
  212. :DelLike
  213. #
  214.     setn i 1
  215.  
  216. :dloop
  217.     seta  dnam %%box%i%%%
  218.     seta  dname "%dnam%" |BOX=
  219.  
  220.     compa "%dname%" with "##EOF##"
  221.     ifequ goto dend
  222.  
  223.     compa "%like%" with "%dname%"
  224.     ifnequ goto dgoon
  225.  
  226.     seta box%i% *
  227.  
  228. :dgoon
  229.     inc i
  230.     goto dloop
  231.  
  232.  
  233. :dend
  234.     kill i
  235.     kill dnam
  236.     kill dname
  237.     kill like
  238.     return
  239.  
  240. #####################################
  241.